#ifndef OBJECTMANAGER_H
#define OBJECTMANAGER_H

#include <GameGlobals.h>
#include <set>
class BaseObject;

//use this macro to create game objects, cleaner code
#define CreateGameObject( ClassName ) \
	External::objects->CreateObject<ClassName>( new ClassName() )

class ObjectManager
{
	public:

		ObjectManager();
		~ObjectManager();

		template <typename T>
		T* CreateObject(T* obj);

		void AddObject( BaseObject* obj );
		void RemoveObject( BaseObject* obj );
		//void Input(const bool* keys, float fps);
		void Update(float dt);
		void Draw();
		void Cleanup();

	public:

		std::vector<BaseObject*> objects;
		
	private:
		void ExecuteRemoveObject( BaseObject* obj );
		std::set<BaseObject*> deleteList;
};


template <typename T>
T* ObjectManager::CreateObject(T* obj)
{
	AddObject( obj );
	return obj;
}

#endif